package pkg.customer;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import retail.bo.CustomerBo;

public class ForgotPassword_RepAction extends Action {
	private CustomerBo customerBo;
	
	public CustomerBo getCustomerBo() {
		return customerBo;
	}

	public void setCustomerBo(CustomerBo customerBo) {
		this.customerBo = customerBo;
	}
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		//session, dynaform objects, request parameters from jsp page
		HttpSession session = request.getSession();
		DynaActionForm myform = (DynaActionForm) form;
		
		String fname=(String)myform.get("fname");
     	String lname=(String)myform.get("lname");
     	String email=(String)myform.get("email");
     	String password=(String)myform.get("password");
     	String userid=(String)session.getAttribute("userid");
     	boolean correct=customerBo.checkDetailsRep(userid,fname,lname,email,password);
     	if(correct==true){
 	     	session.setAttribute("msg","Details correct, password updated");
 			return mapping.findForward("ForgotPassword_Rep");
     	}
     	else
     	{
 	     	session.setAttribute("msg","Details incorrect");
 			return mapping.findForward("ForgotPassword_Rep");
     	}

	}
}     	